<!DOCTYPE html>
<html>
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf8">
	</head>
	<body>
		
		<h2> 为JSON字符串创建对象</h2>
		<p id = "JSONdemo">come on</p>
		<script type="text/javascript">
		var text='{"employees":[{"firstname":"John","lastname":"Doe"},{"firstname":"Anna","lastname":"Smith"},{"firstname":"Peter","lastname":"Jones"}]}'

		obj=JSON.parse(text);
		document.getElementById("JSONdemo").innerHTML = obj.employees[1].firstname + " " + obj.employees[1].lastname;
		</script>
		
	</body>
</html>